var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = t("UIBase"),
    s = t("BaseMask"),
    c = t("GuildDo"),
    p = cc._decorator,
    l = p.ccclass,
    d =
        (p.property,
        p.menu,
        (function (t) {
            i(e, t);
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                e.maskTool = null;
                e.guildDo = new c.default();
                e.isOpenClickAren = !1;
                e.isClick = !1;
                return e;
            }
            e.prototype.onShowEnd = function () {
                console.log("UIGuild -----------------检测引导数据 " + GuildCache.checkKey);
                var t = GuildCache.getCheckCof(GuildCache.checkKey);
                if (t) {
                    this.maskTool = new s.default(this._mask.$Mask);
                    EVUIEffView.emit(EVUIEffView.enableScroll, !1);
                    this.scheduleOnce(function () {
                        EVUIEffView.emit(EVUIEffView.enableScroll, !0);
                    });
                    this.guildDo.reset(GuildCache.checkKey, t, this.maskTool, this._mask, this.callClick.bind(this));
                    this.maskTool.setInverted(!0);
                    this._clickAren.on(cc.Node.EventType.TOUCH_START, this.touchStarAren.bind(this), this);
                    this._clickAren.on(cc.Node.EventType.TOUCH_END, this.touchEndAren.bind(this), this);
                    this._breakClick.on(cc.Node.EventType.TOUCH_START, this.breakAction.bind(this), this);
                    this.isOpenClickAren = !1;
                    this.allowClickAren();
                } else GuildCache.closeGuildView();
            };
            e.prototype.callClick = function (t) {
                this.isOpenClickAren = !0;
                this.unAllowClickAren();
                var e = this._clickAren.parent.convertToNodeSpaceAR(t.convertToWorldSpaceAR(cc.Vec2.ZERO));
                this._clickAren.setPosition(e);
                this._clickAren.width = t.width;
                this._clickAren.height = t.height;
            };
            e.prototype.getDrawList = function () {
                return [this.maskTool.getNodeToRectObj(this._clickAren)];
            };
            e.prototype.onCloseEnd = function () {
                GuildCache.isCloseOver = !0;
            };
            e.prototype.onCloseStart = function () {
                this.ui_data && this.ui_data.closeCB && this.ui_data.closeCB();
            };
            e.prototype.breakAction = function () {
                this.guildDo.clickAllAren();
            };
            e.prototype.touchStarAren = function () {
                if (this.isOpenClickAren) {
                    this.isClick = !0;
                    if (this.ui_data && this.ui_data.touchStart) {
                        this.ui_data.touchStart();
                        this.ui_data.touchStart = null;
                    }
                    this.guildDo.touchStart();
                }
            };
            e.prototype.touchEndAren = function () {
                if (this.isClick) {
                    this.isClick = !1;
                    if (this.ui_data && this.ui_data.touchEnd) {
                        this.ui_data.touchEnd();
                        this.ui_data.touchEnd = null;
                    }
                    this.guildDo.touchEnd();
                    this.guildDo.checkClose();
                }
            };
            e.prototype.allowClickAren = function () {
                this.setNodeActive(this._breakClick);
                this.setNodeActive(this._clickAren);
            };
            e.prototype.unAllowClickAren = function () {
                this.setNodeActive(this._breakClick, !0);
                this.setNodeActive(this._clickAren, !0);
            };
            e.prototype.setClickArenStatus = function () {
                this.setNodeActive(this._clickAren, !1);
            };
            e.prototype.setNodeActive = function (t, e) {
                void 0 === e && (e = !1);
                t && t._touchListener && (t._touchListener.swallowTouches = e);
            };
            e.prototype.update = function () {
                this.guildDo.canDoTask() && this.guildDo.doTask();
            };
            return n([l], e);
        })(r.default));
o.default = d;
